package com.amigo.online.provider.sync.handle.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.amigo.online.provider.kafka.sender.KafkaMessageSender;

@Component
public abstract class AbstractDataHandler {

    @Autowired
    KafkaMessageSender kafkaMessageSender;

    /**
     * 通用logger记录
     */
    protected final Logger logger = LoggerFactory.getLogger(getClass());

    //protected static KafkaMessageSender kafkaMessageSender = KafkaMessageSender.getInstance();


    /**
     * solr 更新命令
     * 核心思想是生成对应的命令字符串
     *
     * @param source
     * @return
     */
    public static String getMapString(Object source) {
        StringBuffer sb = new StringBuffer();
        sb.append("{set=")
                .append(source.toString())
                .append("}");
        return sb.toString();
    }

    /**
     * 责任链模式
     */
    private DataHandler dataHandler;

    public DataHandler getDataHandler() {
        return dataHandler;
    }

    public void setDataHandler(DataHandler dataHandler) {
        this.dataHandler = dataHandler;
    }


}
